<?php
 /*
 * 1626cms 管理中心 網站設置 數據調用函數
 * ============================================================================
 * 版權所有: 1626網絡，并保留所有權利。
 * 網站地址: http://www.1626.com；
 * ----------------------------------------------------------------------------
 * 這不是一個自由軟件！您只能在不用于商業目的的前提下對程序代碼進行修改和
 * 使用；不允許對程序代碼以任何形式任何目的的再發布。
 * ============================================================================
*/
 if(!defined('IN_QISHI'))
 {
 	die('Access Denied!');
 }
//獲取后臺導航(已選定)------------------------
function get_admin_navigation(){
global $db;
$sql = "select * from ".table('admin_navigation')." where is_show='1' ORDER BY category_order asc,id desc  LIMIT 6";
$category_list=$db->getall($sql);
return $category_list;
}
//獲取后臺導航(所有)------------------------
function get_admin_navigation_all(){
global $db;
$sql = "select * from ".table('admin_navigation')." where ParentID=0  ORDER BY category_order desc,id asc";
$category_list=$db->getall($sql);
for ($i = 0;$i < count($category_list); $i++)
{
$sqlf = "select * from ".table('admin_navigation')." where ParentID=".$category_list[$i]['id']."  ORDER BY category_order desc,id asc";
$category_f=$db->getall($sqlf);
$category_list[$i]['category']=$category_f;
}
return $category_list;
}
//獲取會員注冊協議
function get_agreement(){
global $db;
$sql = "select * from ".table('agreement')." where id=1";
$category=$db->getone($sql);
$content=$category['content'];
return $content;
}
//獲取前臺導航所有
function get_navigation($typeid=1){
global $db;
$result = $db->query("SELECT * FROM ".table('navigation')." where typeid='".intval($typeid)."'  ORDER BY display desc,navigationorder desc,id asc");
while($row = $db->fetch_array($result))
{
if ($row['systemclass']=="1")
{
$row['url']=url_rewrite($row['url_rewrite']);
}
$row['url_str']=cut_str($row['url'],12,0);
$row_arr[] = $row;
}
return $row_arr;
}
//獲取前臺導航（單個）
function get_navigation_one($id){
global $db;
if (!is_numeric($id)) return false;
$sql = "select * from ".table('navigation')." where id=".$id;
$category_one=$db->getone($sql);
if ($category_one['systemclass']=="1")
{
$category_one['url']=url_rewrite($category_one['url_rewrite']);
}
$category_one['url_str']=cut_str($category_one['url'],12,0);
return $category_one;
}
//刪除前臺導航欄目
function del_navigation($del_id)
{
global $db;
if (!is_numeric($del_id)) return false;
if (!$db->query("Delete from ".table('navigation')." WHERE id='".intval($del_id)."' AND systemclass<>'1' ")) return false;
return true;
}
?>
